package com.cy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Luckyh
 * @date : 2021/4/9 16:59
 */
@RestController
@RequestMapping("/consumer/feign/")
public class FeignConsumerController {

    @Autowired
    private ConsumerHttpApi consumerHttpApi;

    @GetMapping("{string}")
    public String doEcho(@PathVariable String string){
        return consumerHttpApi.doEcho(string);
    }


}

@RestController
@FeignClient("nacos-provider")
interface ConsumerHttpApi{
    @GetMapping("/provider/echo/{string}")
    public String doEcho(@PathVariable String string);
}
